package com.android.place360.place_search_result;

import java.util.Date;

import com.android.place360.R;
import com.android.place360.place_detail.DetailRequest;
import com.android.place360.place_detail.DetailResponse;
import com.android.place360.place_detail.DetailResult;

import android.content.Context;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.TextView;


public class PlaceDetailAsyncTask extends AsyncTask<Void, Void, Void> {

	Context context;
	String reference;
	//Handler handler;
	DetailResult detailResult;
	boolean lastItem;
	
	
	
	public PlaceDetailAsyncTask(Context context, String reference,
			DetailResult detailResult, boolean lastItem) {
		super();
		this.context = context;
		//this.handler = handler;
		this.reference = reference;
		this.detailResult = detailResult;
		this.lastItem = lastItem;
		
	}


	@Override
	protected void onPostExecute(Void result) {
		
		super.onPostExecute(result);
		
		//if(lastItem){
			//Looper.prepareMainLooper();
			//handler.sendEmptyMessage(0);
		
		//}
	}


	@Override
	protected Void doInBackground(Void... params) {
		
		//test for PlaceDetail API 
		DetailRequest detailRequest = new DetailRequest();
		detailRequest.setKey(context.getString(R.string.google_place_api_key));
		detailRequest.setLanguage("vi");
		detailRequest.setReference(reference);
		detailRequest.setSensor(true);
		DetailResponse detail = detailRequest.getResponse();
		Log.i("place360","END " + String.valueOf(new Date().getSeconds()));
		//this.detailResult  = detail.getResult();
		return null;
	}


	
	
	

}
